﻿@using GoodMan.Infrastructure.Entities.Entity;
@{
    ViewBag.Title = "套餐列表";
    Layout = "~/Areas/WorkSpace/Views/Shared/_CollegeAdminTemplete.cshtml";
    ItemListBox<Product> data = ViewBag.Data;

    string SearchKey = ViewBag.SearchKey;
}
@section head{
    <script type="text/javascript" src="/Scripts/jquery.js"></script>
    <script type="text/javascript" src="/Scripts/plug.js"></script>
    <link type="text/css" rel="Stylesheet" href="/content/css/select2.css" />
}
<div id="content-header">
    <h1>
        套餐列表</h1>
</div>
<div id="breadcrumb">
    <a href="index.html" title="Go to Home" class="tip-bottom"><i class="icon-home"></i>
        首页</a> <a href="#" class="tip-bottom">商品管理</a> <a href="#" class="current">套餐</a>
</div>
<div class="container-fluid">
    <div class="row-fluid">
        <div class="span12">
            <div class="widget-box">
                <div class="widget-title">
                    <h5>
                        套餐列表</h5>
                </div>
                <div class="widget-content nopadding">
                    <form action="/CollegeAdmin/SearchPackagesProducts" method="post" class="form-horizontal">
                    <table border="0" cellpadding="0" cellspacing="0" style="width: 100%;">
                        <tr>
                            <td style="width: 40%">
                                <div class="control-group">
                                    <label class="control-label">
                                        套餐关键字</label>
                                    <div class="controls">
                                        <input type="text" value="@SearchKey" name="ProductKey" style="width: 80%" />
                                    </div>
                                </div>
                            </td>
                            <td style="width: 20%">
                                <div class="controls" style="margin-left: 30px;">
                                    <button type="submit" class="btn btn-primary">
                                        <i class="icon-search icon-white"></i>查询</button>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="3">
                                <table class="table table-bordered table-striped" style="width: 100%;">
                                    <thead>
                                        <tr>
                                            <th width="10%">
                                                货号
                                            </th>
                                            <th width="15%">
                                                名称
                                            </th>
                                            <th width="18%">
                                                所有商品
                                            </th>
                                            <th width="8%">
                                                图片
                                            </th>
                                            <th width="8%">
                                                购入价格
                                            </th>
                                            <th width="8%">
                                                现售价格
                                            </th>
                                            <th width="8%">
                                                库存数量
                                            </th>
                                            <th width="15%">
                                                创建信息
                                            </th>
                                            <th width="10%">
                                                操作
                                            </th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        @{
                                            if (data != null && data.Data != null && data.Data.Any())
                                            {
                                                foreach (var item in data.Data)
                                                {
                                            <tr>
                                                <td style="vertical-align: middle">
                                                    @item.ProductCode
                                                </td>
                                                <td style="vertical-align: middle">
                                                    <a href="../../Shop/PackagesProductsDetail?Id=@item.Id" target="_blank" ><span title="@item.ProductName">@item.ProductName</span></a>
                                                </td>
                                                <td style="vertical-align: middle">
                                                    @{
                                                
                                                                                                                                                 if (item.Version != null && item.Version != "")
                                                                                                                                                 {
                                                                                                                                                     string[] verArray = item.Version.Split(';');
                                                                                                                                                     int j = 0;
                                                                                                                                                     foreach (var itemTemp in verArray)
                                                                                                                                                     {
                                                                                                                                                         var verName = itemTemp.Split('#')[0];
                                                                                                                                                         var verValue = itemTemp.Split('#')[1].Replace("|", "     ");
                                                        @verName<span>&nbsp;&nbsp;->>&nbsp;&nbsp;</span>@verValue<br />
                                                                                                                                                     }
                                                                                                                                                 }
                                                    }
                                                </td>
                                                <td style="vertical-align: middle">
                                                    @{
                                                                                                                                                 if (item.Images != null && item.Images.Length > 0)
                                                                                                                                                 {
                                                                                                                                                     string[] imagesArr = item.Images.Split(';');
                                                                                                                                                     if (imagesArr.Length > 0)
                                                                                                                                                     {
                                                                                                                                                         for (int i = 0; i < imagesArr.Length; i++)
                                                                                                                                                         {
                                                            
                                                        <img alt="图片" src="@imagesArr[i]" style="width:115px; height:50px;" /><br />
                                                                                                                                                         }
                                                                                                                                                     }
                                                                                                                                                 }
                                                    }
                                                </td>
                                                <td style="vertical-align: middle">
                                                    <span>&yen;</span>@item.PurchasePrice
                                                </td>
                                                <td style="vertical-align: middle">
                                                    <span>&yen;</span>@item.DefaulSalePrice
                                                </td>
                                                <td style="vertical-align: middle">
                                                    <a href="/workspace/CollegeAdmin/ProductRepertoryDetail?id=@item.Id&areacode=4&page=@data.CurrentPage&productkey=@SearchKey" title="点击进行库存设置">@item.TotalRemain</a>
                                                </td>
                                                <td style="vertical-align: middle">
                                                    <span title="@item.CreateDate">@item.CreateDate.ToShortDateString()</span>
                                                </td>
                                                
                                                <td class="center" style="vertical-align: middle">
                                                    <a href="/workspace/CollegeAdmin/GeneralPackagesProductsDetail?id=@item.Id&page=@data.CurrentPage&productkey=@SearchKey" class="btn btn-primary btn-mini" style="margin-top:10px">
                                                        编辑</a> <a href="/workspace/CollegeAdmin/DeletePackagesProducts?id=@item.Id&page=@data.CurrentPage&productkey=@SearchKey" class="btn btn-danger btn-mini"   onclick="if (confirm('确认删除数据？删除后该数据无法恢复！')==true){return true;}else{return false;}"   style="margin-top:10px">
                                                            删除</a>
                                                </td>
                                            </tr>
                                                }
                                            }
                                            else
                                            {
                                            <tr>
                                                <td colspan="10" align="center">
                                                    无套餐数据，请添加
                                                </td>
                                            </tr>  
                                            }
                                        }
                                    </tbody>
                                </table>
                            </td>
                        </tr>
                    </table>
                    </form>
                </div>
                @Html.Raw(data.PageItemSegment)
            </div>
        </div>
    </div>
</div>
@section tail{
    <script type="text/javascript" src="/scripts/select2.min.js"></script>
    <script type="text/javascript">
        $(function () {
            $('#likProduct').addClass('open');

            $('#likProduct').addClass('active');

            $('#ProductType').each(function () {
                $(this).select2();
            });

            $('#ProductSubType').each(function () {
                $(this).select2();
            });
        });
    </script>
}
